package com;

import java.util.ArrayList;
import java.util.List;

public class Demo {

    public static void main(String[] args) {
       String s1 = "hello";
       String s2 = "world";
        System.out.println(s1+"---"+s2);
        change(s1,s2);
        System.out.println(s1+"---"+s2);

        Integer num1 = 300;
        // 尝试修改值，实际是创建了新的 Integer 对象
        Integer num2 =  500;
        change1(num1,num2);
        System.out.println(num1+"---"+num2);

    }

    private static void change1(Integer s1, Integer s2) {
        s1 += s2;
        s2 = s1+s2;
        System.out.println(s1+"---"+s2);
    }

    private static void change(String s1, String s2) {
        s1 = s2;
        s2 = s1+s2;
    }
}
